/* static/css/department.css */
.department-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.module-title {
    font-size: 1.5rem;
    color: #333;
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background-color: #4a6cf7;
    color: white;
}

.btn-primary:hover {
    background-color: #3a5bd9;
}

.btn-export {
    background-color: #28a745;
    color: white;
}

.btn-export:hover {
    background-color: #218838;
}

.btn-hierarchy {
    background-color: #17a2b8;
    color: white;
}

.btn-merge {
    background-color: #6f42c1;
    color: white;
}

/* 返回按钮 */
.btn-back {
    background-color: #6c757d;
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 1rem;
}

.btn-back:hover {
    background-color: #5a6268;
}

/* 部门树形表格样式 */
.department-tree {
    margin-top: 1.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.data-table th,
.data-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* 树形结构样式 */
.department-row {
    background-color: #fff;
}

.sub-department-row {
    background-color: #f8f9fa;
}

/* 确保图标可点击 */
.toggle-icon {
    cursor: pointer;
    display: inline-block;
    width: 20px;
    text-align: center;
    margin-right: 5px;
}

.toggle-placeholder {
    display: inline-block;
    width: 20px;  /* 保持对齐 */
}

.toggle-icon.has-children {
    color: #4a6cf7;  /* 有子部门的蓝色+号 */
    cursor: pointer; /* 可点击样式 */
}

.toggle-icon.no-children {
    color: #6c757d;  /* 无子部门的灰色圆点 */
    font-size: 1.2em; /* 稍微放大圆点 */
}

/* 行高亮效果 */
tr:hover {
    background-color: #f5f5f5;
}

/* 确保子部门操作按钮可见 */
.sub-department-row .action-buttons {
    visibility: visible !important;
    opacity: 1 !important;
}

/* 子部门缩进样式 */
.sub-department-row td:first-child {
    padding-left: inherit !important;
}

.sub-department-row .toggle-icon {
    margin-right: 8px;
}

/* 按钮行样式 */
.button-row {
    display: block;
    margin-bottom: 5px; /* 行间距 */
}

/* 操作按钮样式 */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-action {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
}

.btn-action.edit {
    background-color: #ffc107;
    color: #212529;
}

.btn-action.set-head {
    background-color: #17a2b8;
    color: white;
}

.btn-action.enable {
    background-color: #28a745;
    color: white;
}

.btn-action.disable {
    background-color: #dc3545;
    color: white;
}

.btn-action.add-child {
    background-color: #6f42c1;
    color: white;
}

/* 查看按钮样式 */
.btn-action.view {
    background-color: #17a2b8; /* 青色 */
    color: white;
}

.btn-action.view:hover {
    background-color: #138496; /* 深青色 */
}

/* 删除按钮样式 */
.btn-action.delete {
    background-color: #dc3545; /* 红色 */
    color: white;
}

.btn-action.delete:hover {
    background-color: #c82333; /* 深红色 */
}

/* 状态标签 */
.status-active {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #28a745;
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
}

.status-inactive {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #dc3545;
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* 搜索区域样式 */
.search-filter {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.search-form {
    display: flex;
}

.search-group {
    display: flex;
    flex: 1;
    gap: 0.5rem;
    align-items: center; /* 添加垂直居中 */
}

.search-input {
    flex: 1;
    min-width: 70%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    height: 38px; /* 固定高度与按钮一致 */
    box-sizing: border-box; /* 确保padding不影响总高度 */
}

.search-group button {
    width: auto;
    padding: 0.5rem 1rem;
    height: 38px;
    margin: 0;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 特定按钮样式 */
.search-group .btn-search {
    background-color: #4a6cf7;
    color: white;
    min-width: 80px; /* 设置最小宽度 */
}

.search-group .btn-reset {
    background-color: #6c757d;
    color: white;
    min-width: 80px; /* 设置最小宽度 */
}

/* 添加到department.css */
.global-controls {
    margin: 15px 0;
    display: flex;
    gap: 10px;
}

.btn-expand {
    background-color: #28a745;
    color: white;
}

.btn-collapse {
    background-color: #dc3545;
    color: white;
}

.btn-add-top-dept {
    white-space: nowrap; /* 防止文字换行 */
    padding: 8px 12px;   /* 调整内边距 */
    display: inline-flex;
    align-items: center;
}

.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.flash-message {
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
    animation: fadeIn 0.5s;
}

.flash-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 设置负责人弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 40%;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    margin-top: 0;
    color: #333;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 弹窗按钮容器样式 */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px; /* 按钮间距 */
    margin-top: 20px;
}

/* 按钮基础样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    min-width: 80px; /* 设置最小宽度保持按钮大小一致 */
    text-align: center;
    transition: background-color 0.3s;
    text-decoration: none;
}

/* 主要按钮样式 */
.btn-primary {
    background-color: #007bff;
    color: white;
    max-width: 80px;
}

.btn-primary:hover {
    background-color: #0069d9;
}

/* 次要按钮样式 */
.btn-secondary {
    background-color: #6c757d;
    color: white;
    max-width: 80px;
}

.btn-secondary:hover {
    background-color: #5a6268;
}